package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@Mapper
public interface UserMapper {

    /**
    * 插入
     * @param user
     * */
    void insert(User user);

    /**
     * 根据openid查询用户
     * * @return
     */
    @Select("select * from user where openid = #{openid}")
    User getByOpenid(String openid);

    /**
     * 根据id查询用户
     * * @return
     */
    @Select("select id, openid, name, phone, sex, id_number, avatar, create_time " +
            "from user where id = #{userId}")
    User getById(Long userId);

    /**
     * 根据时间查询用户
     * @param map
     */
    Integer countByMap(Map map);
}
